using ProduceBasicData.Api.DTO;
using ProduceBasicData.ErrorCode;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace ProduceBasicData.Api.Services
{
    /// <summary>
    /// 通知服务接口
    /// </summary>
    public interface INotificationService
    {
        /// <summary>
        /// 发送工单下发通知
        /// </summary>
        /// <param name="workOrderCode">工单编号</param>
        /// <param name="message">通知消息</param>
        /// <returns></returns>
        Task<ApiResult<bool>> SendWorkOrderIssueNotificationAsync(string workOrderCode, string message);

        /// <summary>
        /// 发送报工单提交通知
        /// </summary>
        /// <param name="productionReportCode">报工单号</param>
        /// <param name="message">通知消息</param>
        /// <param name="userId">接收用户ID</param>
        /// <param name="userName">接收用户名</param>
        /// <returns></returns>
        Task<ApiResult<bool>> SendProductionReportSubmitNotificationAsync(string productionReportCode, string message, int? userId = null, string? userName = null);

        /// <summary>
        /// 发送实时通知
        /// </summary>
        /// <param name="notification">通知信息</param>
        /// <returns></returns>
        Task<ApiResult<bool>> SendRealtimeNotificationAsync(RealtimeNotificationDto notification);

        /// <summary>
        /// 获取用户通知列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="isRead">是否已读（可选）</param>
        /// <returns></returns>
        Task<ApiResult<ApiPaging<NotificationDto>>> GetUserNotificationsAsync(int userId, int pageIndex = 1, int pageSize = 10, bool? isRead = null);

        /// <summary>
        /// 获取未读通知数量
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        Task<ApiResult<int>> GetUnreadNotificationCountAsync(int userId);

        /// <summary>
        /// 标记通知为已读
        /// </summary>
        /// <param name="notificationId">通知ID</param>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        Task<ApiResult<bool>> MarkAsReadAsync(int notificationId, int userId);

        /// <summary>
        /// 标记所有通知为已读
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        Task<ApiResult<bool>> MarkAllAsReadAsync(int userId);

        /// <summary>
        /// 删除通知
        /// </summary>
        /// <param name="notificationId">通知ID</param>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        Task<ApiResult<bool>> DeleteNotificationAsync(int notificationId, int userId);
    }
}

